package cn.redsoft.wechatapi.handler;

import java.text.SimpleDateFormat;
import java.util.Date;

import cn.redsoft.wechatapi.msg.req.event.UnsubscribeEventRequestMsg;
import cn.redsoft.wechatapi.msg.resp.passivity.PassivityResponseMsg;
import cn.redsoft.wechatapi.msg.resp.passivity.TextResponseMsg;

public class UnSubscribeEventHandler implements
		RequestMessageHandler<UnsubscribeEventRequestMsg> {

	@Override
	public PassivityResponseMsg doHandle(UnsubscribeEventRequestMsg msg) {
		String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
				.format(new Date());
		TextResponseMsg responseMsg = new TextResponseMsg(
				msg.getFromUserName(), msg.getToUserName(),
				new Date().getTime(), "" + msg.getEventKey() + " " + date);
		return responseMsg;
	}

}
